﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TestGenerator
{
    public class Settings
    {
        public string InputFileName { get; set; }
        public string OutputFilename { get; set; }
        public string AnswersOutput { get; set; }
        public int NumberOfTests { get; set; }
        public int MaxQuestionsCount { get; set; }
        public int MaxAnswersPerQuestion { get; set; }

        public Settings(string settingsFile)
        {
            using (StreamReader inputFile = new StreamReader(settingsFile))
            {
                char[] splitters = { '=' };

                while (!inputFile.EndOfStream)
                {
                    string[] input = inputFile.ReadLine().Split(splitters, StringSplitOptions.RemoveEmptyEntries);

                    switch (input[0])
                    {
                        case "INPUT_HTML_FILE_NAME":
                            InputFileName = input[1];
                            break;
                        case "OUTPUT_HTML_FILE_NAME_PREFIX":
                            OutputFilename = input[1];
                            break;
                        case "ANSWERS_HTML_OUTPUT_FILE_NAME":
                            AnswersOutput = input[1];
                            break;
                        case "NUMBER_OF_TESTS_TO_GENERATE":
                            NumberOfTests = int.Parse(input[1]);
                            break;
                        case "MAX_QUESTIONS_COUNT_IN_TEST":
                            MaxQuestionsCount = int.Parse(input[1]);
                            break;
                        case "MAX_ANSWERS_PER_QUESTION":
                            MaxAnswersPerQuestion = int.Parse(input[1]);
                            break;
                    }

                }

            }
        }
    }
}